﻿using FluentNHibernate.Mapping;
using EntitiesAndMappings.Entities;

namespace EntitiesAndMappings.Maps
{
    public class ContratoMap : ClassMap<Contrato>
    {
        public ContratoMap()
        {
            Id(x => x.Id).GeneratedBy.Native();
            References(x => x.Trabajador).LazyLoad(Laziness.False).Not.Nullable();
            References(x => x.Empresa).LazyLoad(Laziness.False).Not.Nullable();
            References(x => x.Proyecto).LazyLoad(Laziness.False).Not.Nullable();
            References(x => x.Lote).LazyLoad(Laziness.False).Not.Nullable();
            References(x => x.TipoCargo).LazyLoad(Laziness.False).Not.Nullable();
            Map(x => x.Sueldo).Not.Nullable();
            References(x => x.StatusContrato).LazyLoad(Laziness.False).Not.Nullable();
            Map(x => x.FechaInicioContrato).Not.Nullable();
            Map(x => x.FechaTerminoContrato).Not.Nullable();
            Map(x => x.FechaIngresoCampo).Nullable();
            Map(x => x.FechaSalidaCampo).Nullable();
            Map(x => x.Observaciones).Nullable();
            References(x => x.MotivoLiquidacion).LazyLoad(Laziness.False).Nullable();
            Map(x => x.FechaLiquidacion).Nullable();
            Map(x => x.ObservacionesRenovacion).Nullable();
            Map(x => x.Estado).Not.Nullable();
            Map(x => x.Usuario).Length(50);
        }
    }
}
